<?php	$p=permissionController::singleton(); ?>

<div id="page">

	<div id="content">
	<form method="get" id="tabellaPermessi"action="<?php echo BASE_PATH;?>Utente/Update_PermessiRuolo/?>">
	<input type="hidden" value="<?php echo $_GET[id];?>" id="ruolo" name="ruolo">
		<table>
			<th>Risorsa</th>
			<th>Lettura</th>
			<th>Scrittura</th>
			<th>Cancella</th>
				<?php foreach ($vars as $risorsa=>$result){
				       echo"<tr><td>".$risorsa."</td>";
				       	echo"<td><input type='checkbox' name='permesso[".$risorsa."][]' value='View_'";
				       	if($result[Lettura]==1)
				       	echo "checked='checked' "; 
				       	echo "/></td>\n";
				       		echo"<td><input type='checkbox' name='permesso[".$risorsa."][]' value='Update_'";
				       	if($result[Aggiorna]==1)
				       	echo "checked='checked' "; 
				       	echo "/></td>\n";
				       	echo"<td><input type='checkbox' name='permesso[".$risorsa."][]' value='Delete_'";
				       	if($result[Cancella]==1)
				       	echo "checked='checked' "; 
				       	echo "/></td>\n";
				       
					
				}?>	
				</table>
				<div style="float: left;" id="r"></div>																			
				<div style="float: left;"><input type="button" value="+" id="aggiungiRisorsa"></div>	
				<input type="submit" value="aggiorna">
			</form>
	</div>
</div>
<script type="text/javascript">
$('#aggiungiRisorsa').click(function() {
	ruolo=$('#ruolo').val();
	 $.get("<?php echo BASE_PATH;?>/dib/src/dib/Utente/Update_getAllNoRisorsebyRoulo/", { ruolo: ruolo}, 
			  function(risorse){
				$('#r').html(risorse);
				});
	  
});


</script>